package com.linko.intelligent.remote.core.controller;

import com.github.pagehelper.PageInfo;
import com.linko.intelligent.base.CommonResponse;
import com.linko.intelligent.remote.core.service.IotService;
import com.linko.intelligent.remote.pojo.po.Ioco;
import com.linko.intelligent.remote.pojo.po.IotLatLng;
import com.linko.intelligent.remote.pojo.query.IotQuery;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.query.Param;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @Author yuan
 * @create 2024/4/29 11:42
 */
@RestController
@RequestMapping("/iot")
@Api(value = "IotController", tags = "Iot")
public class IotController {

    @Autowired
    IotService iotService;


    /***
     * iot位置列表
     * @param
     * @return
     */
    @ApiOperation("位置列表")
    @GetMapping(value = "/positionList")
    public CommonResponse<PageInfo<IotLatLng>> list(@Param("query") IotQuery query) {
        return new CommonResponse(CommonResponse.SUCCESS, "", iotService.positionList(query));
    }

    /***
     * iot位置列表
     * @param
     * @return
     */
    @ApiOperation("位置和状态列表")
    @GetMapping(value = "/iocoList")
    public CommonResponse<PageInfo<Ioco>> iocoList(@Param("query") IotQuery query) {
        return new CommonResponse(CommonResponse.SUCCESS, "", iotService.iocoPage(query));
    }

}
